import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:repair_pda/pages/getx_demo/count_controller.dart';

import '../../widgets/cc_button.dart';

// 使用 GetX 实现累加器的页面
class CountPage extends StatelessWidget {
  const CountPage({super.key});

  @override
  Widget build(BuildContext context) {
    final CountController controller = Get.put(CountController());
    return Scaffold(
      appBar: AppBar(
        title: Text('GetX example'),
      ),
      body: Center(
        child: Obx(
            () => Text('Counter ${controller.count}',style: TextStyle(fontSize: 24),)
        ),
      ),
      floatingActionButton: FloatingActionButton(
          onPressed: (){
            controller.increase();
          },
        child: const Icon(Icons.add),
      ),
    );
  }
}
